//
//  YZMAnnouncementListTableViewCell.m
//  YZMicroStock
//
//  Created by Lv.Dongdong on 16/4/28.
//  Copyright © 2016年 cqjr. All rights reserved.
//

#import "YZMAnnouncementListCell.h"
#import <NSDate+DateTools.h>

@interface YZMAnnouncementListCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *timeLabel;

@end

@implementation YZMAnnouncementListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createObjects];
        self.rightMargin = 0.0;
    }
    return self;
}

- (void)createObjects {
    
    WS(ws)
    
    self.titleLabel = [YZMAppStyle labelWithMediumWhite];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(ws).with.offset(ControlSpacing15);
    }];
    
    self.timeLabel = [YZMAppStyle labelWithSmallLightGray];
    [self addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(ws.titleLabel.mas_bottom).with.offset(ControlSpacing10);
        make.left.equalTo(ws).with.offset(ControlSpacing15);
    }];
    
}

- (void)showCellView:(YZMAnnouncementListModel *)item {
    
    self.titleLabel.text = item.noticeTitle;
    
    self.timeLabel.text = [item.releaseTime formattedDateWithFormat:@"yyyy-MM-dd HH:mm:ss"];
}

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
